\documentclass[aspectratio=169]{beamer}
\usepackage{pgfpages}
%\setbeamertemplate{note page}
%\setbeameroption{show notes on second screen}
\usetheme{metropolis}
%\usecolortheme{fly}
\usefonttheme{default}

\setbeamerfont{frametitle}{size=\large}
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage{multirow}
\usepackage{color}
\usepackage{pdfpages}
\usepackage{tabu}
\usepackage{bbm}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{bigstrut}
\usepackage{color,array}
\usepackage{hyperref}
\usepackage{array}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{threeparttable}
%\usepackage[position=top]{subfig}
\usepackage{booktabs}
\usepackage{xcolor,colortbl}
\usepackage{apacite}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{mynode/.style={draw,align=center}}

\newtheorem{assumption}{Assumption}
\captionsetup[subfigure]{labelformat=empty}
\captionsetup[subfloat]{labelformat=empty}
\captionsetup[table]{labelformat=empty}
\captionsetup[figure]{labelformat=empty}

%Stargazedr
\usepackage{dcolumn}

\DeclareCaptionFont{blue}{\color{LightSteelBlue3}}
\newcommand{\foo}{\color{LightSteelBlue3}\makebox[0pt]{\textbullet}\hskip-0.5pt\vrule width 1pt\hspace{\labelsep}}

\newenvironment{wideitemize}{\itemize\addtolength{\itemsep}{10pt}}{\enditemize}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\def\zapcolorreset{\let\reset@color\relax\ignorespaces}
\def\colorrows#1{\noalign{\aftergroup\zapcolorreset#1}\ignorespaces}


%center text in tables
\newcommand{\specialCellCenter}[2][c]{\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\newcommand{\specialcell}[2][l]{\begin{tabular}[#1]{@{}l@{}}#2\end{tabular}}

%\newenvironment{spreaditemize}{
%\begin{wideitemize}
%    \setlength{\itemsep}{6pt}
%    \setlength{\parskip}{6pt}
%    \setlength{\parsep}{6pt}
%}{\end{wideitemize}}
%
%\newenvironment{spreadenumerate}{
%\begin{enumerate}
%    \setlength{\itemsep}{6pt}
%    \setlength{\parskip}{6pt}
%    \setlength{\parsep}{6pt}
%}{\end{enumerate}}


%\setbeamertemplate{itemize/enumerate subbody begin}{\footnotesize}
%\setbeamertemplate{itemize/enumerate subsubbody begin}{\scriptsize}
\newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}}
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}
\newenvironment{changemargin}[2]{%
  \begin{list}{}{%
    \setlength{\topsep}{0pt}%
    \setlength{\leftmargin}{#1}%
    \setlength{\rightmargin}{#2}%
    \setlength{\listparindent}{\parindent}%
    \setlength{\itemindent}{\parindent}%
    \setlength{\parsep}{\parskip}%
  }%
  \item[]}{\end{list}}

%%%%%%% ADD R CODE %%%%%%%%%%%%%%
\usepackage{listings}
\definecolor{DarkGreen}{rgb}{0.0, 0.2, 0.13}
\lstset{language=R,
    basicstyle=\footnotesize\ttfamily,
    stringstyle=\color{DarkGreen},
    otherkeywords={0,1,2,3,4,5,6,7,8,9},
    morekeywords={TRUE,FALSE},
    showstringspaces=false,
    deletekeywords={data,frame,length,as,character},
    keywordstyle=\color{blue},
    commentstyle=\color{DarkGreen},
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\mode<presentation>
\definecolor{important}{rgb}{0.1,0.1,0.9}

%Mauro defined

\makeatletter\let\expandableinput\@@input\makeatother

\DeclareMathOperator*{\argmin}{argmin}
\renewcommand{\hat}{\widehat}

\setbeamertemplate{navigation symbols}{} 

\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\definecolor{myblue}{rgb}{.1,.4,.5}
\title[Instrumental variables]{\textcolor{myblue}{Instrumental variables}}

\author[Romero]{Mauricio Romero}





\setbeamertemplate{note page}[compress]
\setbeamerfont{note page}{size=\tiny}
\setbeameroption{hide notes}
%\setbeameroption{show only notes}



\normalsize
\date{}
%\date{\vspace{-1cm} \textcolor{gray}{Rise Research Retreat} \\ July 7th, 2019}
\begin{document}
\frame{\titlepage}





%\setcounter{tocdepth}{1}
\mode<beamer>{  %  Options for use in slides only.
    \AtBeginSection[] {
    \setcounter{tocdepth}{1}
      \begin{frame}<beamer>{Instrumental variables}
        \tableofcontents
      \end{frame}
      \begin{frame}<beamer>{Instrumental variables}
        \tableofcontents[currentsection]
      \end{frame}
    }
    \AtBeginSubsection[] {
    \setcounter{tocdepth}{2}
      \begin{frame}<beamer>{Instrumental variables}
        \tableofcontents[currentsection,currentsubsection]
      \end{frame}
    }
}


\section{Basic idea}




\begin{frame}{When is IV used?}
Instrumental variables methods are typically used to address the following kinds of problems
		\begin{enumerate}
		\vfill\item Omitted variable bias
		\vfill\item Measurement error
		\vfill\item Simultaneity bias
		\vfill\item Reverse causality
		\vfill\item Randomized control trials with noncompliance
		\end{enumerate}
\end{frame}




\begin{frame}[plain]{Demand and supply curves are unidentified}
	\begin{itemize}
	\vfill\item You can't simple look at correlations between price and quantity to get elasticity of demand
	\vfill\item The pairs of quantity and price are equilibrium values and therefore don't reflect the demand or the supply curve
	\end{itemize}
\end{frame}

\begin{frame}[plain]
 \begin{figure}[h]
\includegraphics[scale=0.5]{figures/IV1.png}
\end{figure}
\end{frame}

\begin{frame}[plain]
 \begin{figure}[h]
\includegraphics[scale=0.5]{figures/IV2.png}
\end{figure}
\end{frame}

\begin{frame}[plain]
 \begin{figure}[h]
\includegraphics[scale=0.5]{figures/IV3.png}
\end{figure}
\end{frame}

\begin{frame}[plain]{Solution:}
	\begin{itemize}
	\vfill\item Something that shifts only one of the curves and traces the other
	\vfill\item This is called an ``instrument''
	\end{itemize}
\end{frame}


\begin{frame}[plain]
 \begin{figure}[h]
\includegraphics[scale=0.5]{figures/IV4.png}
\end{figure}
\end{frame}



\begin{frame}[plain]{For now, assume constant treatment effects}
\begin{itemize}
\vfill\item Constant treatment effects (i.e., $\beta$ is constant across all individual units)
\begin{itemize}
			\vfill\item Constant treatment effects is the traditional econometric pedagogy when first learning instrumental variables
			\vfill\item Identical to assuming that ATE$=$ATT$=$ATU because constant treatment effects assumes $\beta_i=\beta_{-i}=\beta$ for all units
			\end{itemize}
		\end{itemize}
\end{frame}
%
%
%\begin{frame}[plain]
%
%\begin{center}
%\textbf{Heterogenous treatment effects}
%\end{center}
%
%\begin{itemize}
%		\vfill\item Heterogeneous treatment effects (i.e., $\beta_i$ varies across individual units)
%			\begin{itemize}
%			\vfill\item Heterogeneous treatment effects means that the $ATE\neq{ATT}\neq{ATU}$ because $\beta_i$ differs across the population
%			\vfill\item This is equivalent to assuming the coefficient, $\beta_i$, is a random variable that varies across the population
%			\vfill\item Heterogenous treatment effects is based on work by Angrist, Imbens and Rubin (1996) and Imbens and Angrist (1994) which introduced the  ``local average treatment effect'' (LATE) concept
%			\end{itemize}
%\end{itemize}
%
%\end{frame}

%\begin{frame}[plain]
%
%\begin{center}
%\textbf{Data requirements}
%\end{center}
%
%	\begin{itemize}
%	\vfill\item Your data isn't going to come with a codebook saying ``instrumental variable''.  So how do you find it?
%	\vfill\item Well, sometimes the researcher just \emph{knows}.  
%	\vfill\item That is, the researcher knows of a variable ($Z$) that actually \emph{is} randomly assigned and that affects the endogenous variable but not the outcome (except via the endogenous variable)  
%	\vfill\item Such a variable is called an ``instrument''.
%	\end{itemize}
%\end{frame}
%
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{Picking a good instrument}
%\end{center}
%
%	\begin{itemize}
%	\vfill\item The best instruments you think of first, then you seek the data second (but often students go in the reverse order which is basically guaranteed to be a crappy instrument)
%	\vfill\item If you want to use IV, then ask: 
%		\begin{quote}
%		What moves around the covariate of interest that might be plausibly random?
%		\end{quote}
%		\vfill\item Is there any element in the treatment that could be construed as random?  
%		\vfill\item If you were to find that random piece, then you have found an instrument
%	\vfill\item Once you have identified such a variable, begin to think about what data sets might have information on an outcome of interest, the treatment, and the instrument you have put your finger on.
%	\end{itemize}
%\end{frame}
%
%
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{Does family size reduce labor supply or is it selection?}
%\end{center}
%
%Angrist and Evans (1998), ``Children and their parents' labor supply'' \emph{American Economic Review}, 
%		\begin{itemize}
%		\vfill\item They want to know the effect of family size on labor supply, but need exogenous changes in family size
%		\vfill\item So what if I told you if the first two children born were of the same gender, then you're less likely to work. What?!
%		\end{itemize}
%
%\end{frame}
%
%
%\begin{frame}[plain]
%
%\begin{center}
%\textbf{Angrist and Evans cont.}
%\end{center}
%
%\begin{itemize}
%
%		\vfill\item Many parents have a preference for having at least one child of each gender
%			\begin{itemize}	
%			\vfill\item Consider a couple whose first two kids were both boys; they will often have a third, hoping to have a girl
%			\vfill\item Consider a couple whose first two kids were girls; they will often have a third, hoping for a boy
%			\vfill\item Consider a couple with one boy and one girls; they will often not have a third kid
%			\end{itemize}
%		\vfill\item The gender of your kids is arguably randomly assigned (maybe not exactly, but close enough)
%		\end{itemize}
%
%\end{frame}
%
%
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{Good instruments must be a bit strange}
%\end{center}
%
%\begin{itemize}
%		\vfill\item On its face, it's puzzling that the first two kids' gender predicts labor market participation
%		\vfill\item Instrumental variables strategies formalize \emph{strangeness of the instrument}, which is the inference drawn by an intelligent layperson with no particular knowledge of the phenomena or background in statistics.
%		\vfill\item You need more information, in other words, otherwise the layperson can't understand what same gender of your children has to do with working
%\end{itemize}
%
%\end{frame}
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{When a good IV strategy finally makes sense}
%\end{center}
%
%\begin{itemize}
%		\vfill\item But then the researchers point out that women whose first two children are of the same gender are more likely to have additional children than women whose first two children are of different genders
%		\vfill\item The layperson then asks himself, ``Hm. I wonder if the labor market differences are due \emph{solely} to the differences in the number of kids the woman has...''
%
%\end{itemize}
%
%\end{frame}
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{Sunday Candy is a good instrument}
%\end{center}
%
%\begin{itemize}
%		\vfill\item Let's listen to a few lines from ``Ultralight Beam'' by Kanye West. Chance the Rapper sings on it and says
%
%\begin{quote}
%``I made Sunday Candy, I'm never going to hell \\
%
%
%I met Kanye West, I'm never going to fail.'' \\
%
%
%- Chance the Rapper
%\end{quote}
%
%	\vfill\item What does making a song have to do with hell?  What does meeting Kanye West have to do with success? Let's consider each in order
%	\end{itemize}
%\end{frame}
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{What are we missing?}
%\end{center}
%
%			\begin{quote}
%			``I made Sunday Candy, \\
%			I'm never going to hell'', 
%			\end{quote}
%		\begin{itemize}
%		\vfill\item There must be more to this story, right?
%		\vfill\item So what if it's something like this
%		\end{itemize}
%			\begin{quote}
%			``I made Sunday Candy \\
%			 this pastor invited me to church on Sunday, \\
%			  I'm never going to hell''
%			\end{quote}
%
%\end{frame}
%
%
%
%
%\begin{frame}[plain]
%
%	\begin{center}
%	\textbf{Sunday Candy DAG}
%	\end{center}
%	
%	
%	\begin{center}
%	\begin{minipage}{.5\textwidth}
%	
%	\begin{center}
%	
%	\begin{tikzpicture}[node distance=1.5cm]
%	
%		% nodes - for left-hand DAG %
%		\node[text centered] (u) {$U$};
%		\node[below right of  = u, text centered] (y) {$Hell$};
%		\node[below left of = u, text centered] (d) {$Church$};
%		\node[above left of = d, text centered] (z) {$Sunday\ Candy$};
% 
%		% edges %
%		\draw[->, line width=1] (d) -- (y);
%		\draw[->, line width=1] (z) -- (d);
%		\draw[dashed, ->] (u) -- (y);
%		\draw[dashed, ->] (u) -- (d);
%
%		\end{tikzpicture}
%		\end{center}
%		\end{minipage}
%
%
%	\end{center}
%
%
%\end{frame}	
%
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{Kanye West is a bad instrument}
%\end{center}
%
%\begin{itemize}
%\vfill\item Chance long idolized and was inspired by Kanye West -- both Chicago, both very creative hip hop artists
%\vfill\item Kanye West is not a good instrument for Chance's inspiration, though, because Kanye West can singlehandedly make a person's career
%\vfill\item Kanye is not strange enough
%\end{itemize}
%
%\end{frame}
%
%
%\begin{frame}[plain]
%
%	\begin{center}
%	\textbf{Kanye West DAG}
%	\end{center}
%	
%	
%	\begin{center}
%	\begin{minipage}{.5\textwidth}
%	
%	\begin{center}
%	
%	\begin{tikzpicture}[node distance=1.5cm]
%	
%		% nodes - for left-hand DAG %
%		\node[text centered] (u) {$U$};
%		\node[below right of  = u, text centered] (y) {$Success$};
%		\node[below left of = u, text centered] (d) {$Inspiration$};
%		\node[above left of = d, text centered] (z) {$Kanye\ West$};
% 
%		% edges %
%		\draw[->, line width=1] (d) -- (y);
%		\draw[->, line width=1] (z) -- (d);
%		\draw[->, line width=1] (z) -- (y);
%		\draw[dashed, ->] (u) -- (y);
%		\draw[dashed, ->] (u) -- (d);
%
%		\end{tikzpicture}
%		\end{center}
%		\end{minipage}
%
%
%	\end{center}
%
%
%\end{frame}	
%
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{Foreshadowing the questions you need to be asking}
%\end{center}
%
%\begin{enumerate}
%	\vfill\item Is our instrument highly correlated with the treatment? With the outcome? Can you test that?
%	\vfill\item Are there random elements within the treatment? Why do you think that?
%	\vfill\item Is the instrument exogenous?  Why do you think that?
%	\vfill\item Could the instrument affect outcomes directly? Why do you think that?
%	\vfill\item Could the instrument be associated with anything that causes the outcome even if it doesn't directly? Why do you think that?
%\end{enumerate}
%
%\end{frame}




\begin{frame}[plain]{Our causal model: Returns to schooling again}
\begin{eqnarray*}
Y = \alpha + \delta S + \underbrace{\gamma A + \nu}_{\varepsilon}
\end{eqnarray*}
where $Y$ is log earnings, $S$ is years of schooling, $A$ is unobserved ability, and $\varepsilon$ is the total error ($\nu$ is an idiosyncratic shock)


\begin{itemize}
\vfill\item Problem: S is correlated with the error term $\varepsilon$ \pause
	\vfill\item Suppose there is a variable, $Z_i$ correlated with $S_i$ and uncorrelated with $A$ and $\nu$
\end{itemize}

\end{frame}


\begin{frame}[plain]{How can IV be used to obtain consistent estimates?}
		\begin{eqnarray*}
		Cov(Y,Z) 	&=& Cov(\alpha + \delta{S} + \gamma{A} + \nu, Z) \\ \pause
				&=&	E[(\alpha + \delta{S} + \gamma{A} + \nu)  Z] - E[\alpha + \delta{S} + \gamma{A} + \nu]E[Z] \\ \pause
				&=& \{\alpha E(Z) - \alpha E(Z) \} + \delta \{ E(SZ) - E(S)E(Z)\} \\ \pause
				&& + \gamma \{E(AZ) - E(A)E(Z) \} + E(\nu Z) - E(\nu)E(Z) \\ \pause
		Cov(Y,Z)	&=& \delta Cov(S,Z) + \gamma Cov(A,Z) + Cov(\nu,Z)  \pause
		\end{eqnarray*}
\begin{itemize}
		\vfill\item  $Cov(S,Z)\neq{0}$: Instrument is \textbf{relevant} or ``first stage'' exists.  $S$ and $Z$ are correlated  \pause
	\end{itemize}
		\begin{eqnarray*}
		\frac{Cov(Y,Z)}{Cov(S,Z)}	&=& \delta  + \gamma \frac{Cov(A,Z)}{Cov(S,Z)} + \frac{Cov(\nu,Z)}{Cov(S,Z)} 
		\end{eqnarray*}
		
			
\end{frame}

\begin{frame}[plain]{How can IV be used to obtain consistent estimates?}
		\begin{eqnarray*}
		\frac{Cov(Y,Z)}{Cov(S,Z)}	&=& \delta  + \gamma \frac{Cov(A,Z)}{Cov(S,Z)} + \frac{Cov(\nu,Z)}{Cov(S,Z)}  \pause
		\end{eqnarray*}
\begin{itemize}
\vfill\item $Cov(A,Z)=Cov(\nu ,Z)=0$: Instrument is \textbf{valid} or ``exclusion restriction'' ($Z$ only affects $Y$ through $S$)
		\end{itemize}
					\begin{eqnarray*}
		\frac{Cov(Y,Z)}{Cov(S,Z)}	&=& \delta  + \underbrace{\gamma \frac{Cov(A,Z)}{Cov(S,Z)} + \frac{Cov(\nu,Z)}{Cov(S,Z)}}_{0} \\
		 \frac{Cov(Y,Z)}{Cov(S,Z)}	&=& \delta
		\end{eqnarray*}
\end{frame}

%\begin{frame}[plain]{How can IV be used to obtain consistent estimates?}
%
%		\begin{itemize}
%		
%		\end{itemize}
%	\vfill\item Assuming the first stage exists and that the exclusion restriction holds, then we can estimate $\delta$ with $\delta_{IV}$:
%	\begin{eqnarray*}
%	\delta_{IV} &=& \frac{Cov(Y,Z)}{Cov(S,Z)} \\ 
%	&=&\delta
%	\end{eqnarray*}
%\end{frame}


%
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{IV Assumptions}
%\end{center}
%
%\begin{itemize}
%	\vfill\item But, if $Z$ is \emph{not} independent of $\eta$ (either correlated with $A$ or $\nu$), \emph{and} if the correlation between $S$ and $Z$ is ``weak'', then the second term blows up. 
%	\vfill\item We will explore the problems created by weak instruments in just a moment. 
%	\vfill\item First, let's look at a DAG summarizing all this information
%
%\end{itemize}
%
%\end{frame}
%
%
%\begin{frame}[plain]
%
%	\begin{center}
%	\textbf{One of these DAGs is not like the other}
%	\end{center}
%	
%	
%	\begin{center}
%	\begin{minipage}{.5\textwidth}
%	
%	\begin{tikzpicture}[node distance=1.5cm]
%	
%		% nodes - for left-hand DAG %
%		\node[text centered] (A) {$A$};
%		\node[below right of  = A, text centered] (y) {$Y$};
%		\node[below left of = A, text centered] (s) {$S$};
%		\node[above left of = s, text centered] (z) {$Z$};
% 
%		% edges %
%		\draw[->, line width=1] (s) -- (y);
%		\draw[->, line width=1] (z) -- (s);
%		\draw[dashed, <->] (A) -- (y);
%		\draw[dashed, <->] (A) -- (s);
%
%		\end{tikzpicture}
%		\end{minipage}
%\begin{center}
%\emph{(a)}
%\end{center}
%
%  \vskip6pt plus.1fill
%		
%		\begin{minipage}{.5\textwidth}
%		\begin{tikzpicture}[node distance=1.5cm]
%
%		% nodes - for left-hand DAG %
%		\node[text centered] (A) {$A$};
%		\node[below right of  = A, text centered] (y) {$Y$};
%		\node[below left of = A, text centered] (s) {$S$};
%		\node[above left of = s, text centered] (z) {$Z$};
% 
%		% edges %
%		\draw[->, line width=1] (s) -- (y);
%		\draw[->, line width=1] (z) -- (s);
%		\draw[dashed, <->] (A) -- (y);
%		\draw[dashed, <->] (A) -- (s);
%		\draw[dashed, <->] (A) -- (z);
%		\end{tikzpicture}
%		\end{minipage}
%\begin{center}
%\emph{(b)}
%\end{center}
%
%	\end{center}
%
%Notice - the top DAG, \emph{a}, satisfies both exclusion and relevance (i.e., non-zero first stage), but the bottom DAG, \emph{b}, satisfies relevance but not exclusion.
%
%\end{frame}

\section{Two stage least squares}

\begin{frame}{Two-stage least squares}
	\begin{itemize}
	\vfill\item The two-stage least squares estimator was developed by Theil (1953) and Basman (1957) independently
	\vfill\item While IV is a research design, 2SLS is a specific estimator. 
	\vfill\item Others include LIML, the Wald estimator, jacknive IV, two sample IV, and more
	\end{itemize}
\end{frame}

%\begin{frame}[plain]{Two Sample IV}
%
%	\begin{itemize}
%	\vfill\item In a pinch, you can even get by with two different data sets
%		\begin{enumerate}
%		\vfill\item Dataset 1 needs information on the outcome and the instrument 
%		\vfill\item Dataset 1 needs  information on the treatment and the instrument.
%		\end{enumerate}
%	\vfill\item This is known as ``Two sample IV'' because there are two \emph{samples} involved, rather than the traditional one sample.
%	\vfill\item Once we define what IV is measuring carefully, you will see why this works.
%	\end{itemize}
%\end{frame}


\begin{frame}[plain]{Two-stage least squares concepts}
	\begin{itemize}
	\vfill\item Causal model.  Sometimes called the structural model:$$Y_i=\alpha + \delta{S_i} + \eta_i$$
	\vfill\item First-stage regression. Gets the name because of two-stage least squares:$$S_i = \gamma + \rho{Z_i} + \zeta_i$$
	\vfill\item Second-stage regression. Notice the fitted values, $\widehat{S}$:$$Y_i=\beta + \delta{\widehat{S_i}}+\nu_i$$
	\vfill\item Reduced form a regression of $Y$ onto the instrument:$$Y_i=\psi + \pi{Z_i} + \varepsilon_i$$
	\end{itemize}
	where $Cov(Z,\eta_i)=0$ (instrument is valid) and $\rho\neq{0}$ (instrument is relevant).
\end{frame}





%
%\begin{frame}[plain]{Two-stage least squares}
%Suppose you have a sample of data on $Y$, $X$, and $Z$. For each observation $i$ we assume the data are generated according to
%		\begin{eqnarray*}
%		Y_i &=& \alpha + \delta{S}_i + \eta_i \\
%		S_i &=& \gamma + \rho{Z}_i + \zeta_i
%		\end{eqnarray*}where $Cov(Z,\eta_i)=0$ and $\rho\neq{0}$.
%
%\end{frame}


%\begin{frame}[plain]{Two-stage least squares}
%
%Plug in covariance and write out the following:
%		\begin{eqnarray*}
%		\widehat{\delta_{2sls}} &=& \frac{Cov(Z,Y)}{Cov(Z,S)} \\
%		&=& \frac{ \frac{1}{n}\sum_{i=1}^n(Z_i - \overline{Z})(Y_i - \overline{Y})}{\frac{1}{n}\sum_{i=1}^n(Z_i - \overline{Z})(S_i - \overline{S})} \\
%		&=& \frac{ \frac{1}{n} \sum_{i=1}^n(Z_i - \overline{Z})Y_i}{ \frac{1}{n} \sum_{i=1}^n (Z_i-\overline{Z})S_i}
%		\end{eqnarray*}
%
%\end{frame}
%
%\begin{frame}[plain]
%\begin{center}
%\textbf{Two-stage least squares}
%\end{center}
%
%Substitute the causal model definition of $Y$ to get:
%		\begin{eqnarray*}
%		\widehat{\delta_{2sls} }&=& \frac{ \frac{1}{n} \sum_{i=1}^n (Z_i -\overline{Z})\{ \alpha + \delta{S}_i + \eta_i \}}{\frac{1}{n} \sum_{i=1}^n (Z_i - \overline{Z})S_i} \\
%		&=& \delta + \frac{\frac{1}{n} (Z_i - \overline{Z})\eta_i}{\frac{1}{n}\sum_{i=1}^n(Z_i - \overline{Z})S_i} \\
%		&=& \delta + \text{"small if \emph{n} is large"}
%		\end{eqnarray*}Where did the first term go? Why did the second term become $\delta$?
%
%\end{frame}	

\begin{frame}[plain]{Two-stage least squares: Estimator I}
	
\begin{eqnarray*} 
\delta_{IV} &=& \frac{Cov(Y,Z)}{Cov(S,Z)}\\
&=& \frac{ \frac{Cov(Z,Y)}{Var(Z)}}{ \frac{Cov(Z,S)}{Var(Z)}}
\end{eqnarray*}
\pause
Calculate the ratio of ``reduced form'' ($\pi$) to ``first stage'' coefficient ($\rho$):
		\begin{eqnarray*}
		\widehat{\delta}_{2sls} = \frac{ \frac{Cov(Z,Y)}{Var(Z)}}{ \frac{Cov(Z,S)}{Var(Z)}} = \frac{\widehat{\pi}}{\widehat{\rho}}
		\end{eqnarray*}
\end{frame}


%\begin{frame}[plain]{Two-stage least squares}
%
%Then rewrite $\widehat{\delta}_{2sls}$
%	\begin{eqnarray*}
%	\widehat{\delta}_{2sls} &=& \frac{ Cov(Z,Y)}{ Cov(Z,S)} = \frac{\widehat{\rho}Cov(Z,Y)}{\widehat{\rho}Cov(Z,S)}= \frac{\widehat{\rho}Cov(Z,Y)}{\widehat{\rho}^2Var(Z)} \nonumber \\
%	&=& \frac{Cov(\widehat{\rho}Z,Y)}{Var(\widehat{\rho}Z)} 
%	\end{eqnarray*}
%\end{frame}

\begin{frame}[plain]{Two-stage least squares: Estimator II}
	
Recall $$S_i = \gamma + \rho{Z}_i + \zeta_i$$
Then $$\widehat{S}=\widehat{\gamma} + \widehat{\rho}Z$$  

		\begin{eqnarray*}
		\widehat{\delta}_{2sls} &=&  \frac{Cov(\widehat{S},Y)}{Var(\widehat{S})} \\ \pause 
		&=& \frac{Cov(\widehat{\gamma}+\widehat{\rho}Z,Y)}{Var(\widehat{\gamma}+\widehat{\rho}Z)} \\ \pause 
		&=& \frac{\widehat{\rho}Cov(Z,Y)}{\widehat{\rho}^2 Var(Z)} \\ \pause 
		&=& \frac{Cov(Z,Y)}{\widehat{\rho} Var(Z)}   
		\end{eqnarray*}

\end{frame}

\begin{frame}[plain]{Two-stage least squares: Estimator II}


		\begin{eqnarray*}
		\widehat{\delta}_{2sls} &=& \frac{Cov(Z,Y)}{\widehat{\rho} Var(Z)}  \pause 
		\end{eqnarray*}
Rewrite $\widehat{\rho}$ as

\begin{eqnarray*}
	\widehat{\rho} &=&  \frac{Cov(Z,S)}{Var(Z)} 
	\end{eqnarray*}
Then
\begin{eqnarray*}
		\widehat{\delta}_{2sls} &=&  \frac{Cov(Z,Y)}{\frac{Cov(Z,S)}{Var(Z)} Var(Z)} \\
		&=&  \frac{\frac{Cov(Z,Y)}{ Var(Z)}}{\frac{Cov(Z,S)}{Var(Z)}} 
		\end{eqnarray*}
\end{frame}

%
%\begin{frame}[plain]
%
%		\begin{proof}
%		We will show that $\widehat{\delta}Cov(Y,Z) = Cov(\widehat{S},Y)$.  I will leave it to you to show that $Var(\widehat{\delta}Z) = Var(\widehat{S})$
%		\begin{eqnarray*}
%		Cov(\widehat{S},Y) &=& E[\widehat{S}Y] - E[\widehat{S}]E[Y] \\
%		&=& E(Y[\widehat{\rho} + \widehat{\delta}Z]) - E(Y)E(\widehat{\rho} + \widehat{\delta}Z) \\
%		&=& \widehat{\rho}E(Y) + \widehat{\delta}E(YZ) - \widehat{\rho}E(Y) - \widehat{\delta}E(Y)E(Z) \\
%		&=&\widehat{\delta}[E(YZ) - E(Y)E(Z)] \\
%		Cov(\widehat{S},Y) &=& \widehat{\delta}Cov(Y,Z)
%		\end{eqnarray*}
%		\qedhere
%		\end{proof}
%
%\end{frame}

\begin{frame}[plain]{Intuition of 2SLS}
	\begin{itemize}
	\vfill\item Two stage least squares is nice because in addition to being an estimator, there's also great intuition contained in it which you can use as a device for thinking about IV more generally. 
	\vfill\item The intuition is that 2SLS estimator replaces $S$ with the fitted values of $S$ (i.e., $\widehat{S}$) from the first stage regression of $S$ onto $Z$ and all other covariates.  
	\vfill\item By using the fitted values of the endogenous regressor from the first stage regression, our regression now uses \emph{only} the exogenous variation in the regressor due to the instrumental variable itself
	\end{itemize}
\end{frame}

\begin{frame}[plain]{Intuition of IV in 2SLS}

\begin{itemize}
	\vfill\item \dots but think about it -- that variation was there before, but was just a subset of all the variation in the regressor
	\vfill\item Endogenous variable has pieces that are as good as random, and IV finds them
	\vfill\item Instrumental variables therefore reduces the variation in the data, but that variation which is left is \emph{exogenous}
\end{itemize}
\end{frame}
	




\begin{frame}[plain]{Estimation with software}

	\begin{itemize}
	\vfill\item One manual way is just to estimate the reduced form and first stage coefficients and take the ratio of the respective coefficients on $Z$
	\begin{itemize}
	\vfill\item While it is always a good idea to run these two regressions, don't compute your IV estimate this way 
	\vfill\item Often the case that a pattern of missing data will differ between $Y$ and $S$
	\vfill\item What is the standard error of $\delta_{IV}$ in this case?
	\end{itemize}
	\vfill\item Another is to find the fitted values values of $S$ and run the regression with them
	\begin{itemize}
	\vfill\item While it is always a good idea to run this  regression too (the first stage), don't compute your IV estimate this way 
	\vfill\item The standard errors from the second stage regression are also wrong
	\end{itemize}
	\end{itemize}
\end{frame}



\begin{frame}[plain]{Estimation with software}
\begin{itemize}
	\vfill\item Estimate this in Stata using ivregress 2sls.
	\vfill\item Estimate this in R  using ivreg in the AER package or using feols in the fixest package
\end{itemize}

\end{frame}



\section{Weak instruments}

\begin{frame}{Weak instruments}

\begin{itemize}
\vfill\item A weak instrument is one that is not strongly correlated with the endogenous variable in the first stage
\vfill\item This can happen if the two variables are independent or the sample is small
\vfill\item If you have a weak instrument, the cure ends up being worse than the disease
\end{itemize}

\end{frame}

\begin{frame}[plain]{Weak instruments}
Back to our causal model
		\begin{eqnarray*}
		\delta_{iv}=\frac{Cov(Y,Z)}{Cov(S,Z)}	&=& \delta  + \gamma \frac{Cov(A,Z)}{Cov(S,Z)} + \frac{Cov(\nu,Z)}{Cov(S,Z)} 
		\end{eqnarray*}

If $Cov(S,Z)$ is small, then it ``blows-up'' the $\gamma(Cov(A,Z)+Cov(\eta,Z))$ term
			
\end{frame}



\section{Practical IV Tips}



\begin{frame}{Look at the reduced form}

\begin{enumerate}
	\vfill\item Look at the reduced form
		\begin{itemize}
		\vfill\item The reduced form is estimated with OLS and is therefore unbiased
		\vfill\item If you can't see the causal relationship of interest in the reduced form, it is probably not there
		\end{itemize}
\end{enumerate}

\end{frame}

\begin{frame}[plain]{Report the first stage}
	
	\begin{enumerate}\addtocounter{enumi}{1}
	\vfill\item Report the first stage (preferably in the same table as your main results)
		\begin{itemize}
		\vfill\item Does it make sense?
		\vfill\item Do the coefficients have the right magnitude and sign?
		\vfill\item Please make beautiful IV tables -- you'll be celebrated across the land if you do
		\end{itemize}
		\vfill\item Report OLS -- you said it was biased, but we want to still see it
	\end{enumerate}
\end{frame}

%
%\begin{frame}[plain]{Report $F$ statistic and OLS}
%	\begin{enumerate}\addtocounter{enumi}{2}
%%	\vfill\item Report the $F$-statistic on the excluded instrument(s).
%%		\begin{itemize}
%%		\vfill\item Stock, Wright and Yogo (2002) suggest that $F$-statistics $>10$ indicate that you do not have a weak instrument problem -- this is not a proof, but more like a rule of thumb
%%		\vfill\item If you have more than one endogenous regressor for which you want to instrument, reporting the first stage $F$-statistic is not enough (because 1 instrument could affect both endogenous variables and the other could have no effect -- the model would be under identified). In that case, you want to report the Cragg-Donald EV statistic.
%%		\end{itemize}
%	\vfill\item Report OLS -- you said it was biased, but we want to still see it
%	\end{enumerate}
%
%\end{frame}




%
%\begin{frame}[plain]{Make beautiful pictures of first stage and reduced form}
%
%\begin{enumerate}\addtocounter{enumi}{6}
%\vfill\item This cannot be overstated: you must present your main results in beautiful pictures
%	\begin{itemize}
%	\vfill\item Show pictures of the first stage. Convince the reader something is there.  The eyeball is underrated
%	\vfill\item You can't show a second stage with raw data, so instead show pictures of the reduced form. 
%	\end{itemize}
%\end{enumerate}
%
%\end{frame}

\section{Example}

\begin{frame}{Example}
	\begin{figure}
	\includegraphics[scale=0.8]{figures/Sleep1.pdf}
	\end{figure}
\end{frame}


{
\setbeamercolor{background canvas}{bg=}
\includepdf[pages=4]{figures/Gibson_slides.pdf}
}

{
\setbeamercolor{background canvas}{bg=}
\includepdf[pages=13-39]{figures/Gibson_slides.pdf}
}

{
\setbeamercolor{background canvas}{bg=}
\includepdf[pages=41-44]{figures/Gibson_slides.pdf}
}

{
\setbeamercolor{background canvas}{bg=}
\includepdf[pages=50]{figures/Gibson_slides.pdf}
}

\section{Heterogeneity and the LATE}


\begin{frame}{Heterogenous Treatment Effects}

	\begin{itemize}
	\vfill\item Up to this point, the causal effect was the same for all individuals 
		\begin{itemize}
		\vfill\item Constant treatment effects where $Y_{i}^1 - Y_i^0=\delta$ for all $i$ units
		\end{itemize}
	\vfill\item Let's now try to understand what instrumental variables estimation is measuring if treatment effects are \emph{heterogenous} 
		\begin{itemize}
		\vfill\item $Y_i^1 - Y_i^0=\delta_i$ which varies across the population
		\end{itemize}
	\end{itemize}

\end{frame}

\begin{frame}[plain]{Why do we care about heterogeneity?}

\begin{itemize}
\vfill\item Heterogeneity, it turns out, makes life interesting and challenging
\vfill\item What parameter did we even estimate using IV when there are heterogenous treatment effects?
\vfill\item There are two issues here:
		\begin{enumerate}
		\vfill\item \underline{Internal validity}:  Does the design successfully uncover causal effects for the population that we are studying?
		\vfill\item \underline{External validity}: Does the study's results inform us about different populations?
		\end{enumerate}

\end{itemize}

\end{frame}


\begin{frame}[plain]{Potential outcome notation}
	
``Potential treatment status'' ($D^j$) versus ``observed'' treatment status ($D$)
		\begin{itemize}
		\vfill\item $D^1_{i} = i$'s treatment status when $Z_i=1$
		\vfill\item $D^0_{i} = i$'s treatment status when $Z_i=0$
		\end{itemize}
We'll represent outcomes as a function of both treatment status and instrument status. In other words, $Y_i(D_i=0,Z_i=1)$ is represented as $Y_i(0,1)$

\end{frame}


\begin{frame}[plain]{Switching equation}

Move from potential treatment status to observed treatment status
			\begin{eqnarray*}
			D_i&=&D^0_{i} + (D^1_{i} - D^0_{i})Z_i \\
			&=&\pi_{0i} + \pi_{1i}Z_i + \zeta_i
			\end{eqnarray*}
			\begin{eqnarray*}
			\pi_{0i} &=& E[D^0_{i}] \\
			\pi_{1i} &=& (D^1_{i} - D^0_{i}) \text{is the heterogenous causal effect of the IV on }D_i. \\
			E[\pi_{1i}] &=& \text{The average causal effect of }Z_i\text{ on }D_i
			\end{eqnarray*}

\end{frame}


\begin{frame}[plain]{Identifying assumptions under heterogenous treatment effects}

	\begin{enumerate}
	\vfill\item Stable Unit Treatment Value Assumption (SUTVA)
	\vfill\item Random Assignment
	\vfill\item Exclusion Restriction
	\vfill\item Nonzero First Stage
	\vfill\item Monotonicity
	\end{enumerate}
\end{frame}


\begin{frame}[plain]{Stable Unit Treatment Value Assumption (SUTVA)}
	
	\begin{block}{Stable Unit Treatment Value Assumption (SUTVA)}
	If $Z_i=Z_i'$, then $D_i(\textbf{Z})=D_i(\textbf{Z}')$ \\
	If $Z_i=Z_i'$ and $D_i=D_i'$, then $Y_i(\textbf{D,Z})=Y_i(\textbf{D',Z'})$
	\end{block}
	

\begin{itemize}
\vfill\item Potential outcomes for each person $i$ are unrelated to the treatment status of other individuals
%\vfill\item Example:   Your instrument is the death of a CEO for hirings. But if a CEO dies, then perhaps other companies lose a CEO as they are hired in the vacant spots.
\vfill\item The instrument must not be related to treatment status of other individuals
\end{itemize}	
		
\end{frame}


\begin{frame}[plain]{Independence assumption}
	
	\begin{block}{Independence assumption (e.g., ``as good as random assignment'')}
	$\{Y_i(D^1_i,1),Y_i(D^0_i,0),D^1_{i},D^{0}_i\} \independent{Z}_i$
	\end{block}

\begin{itemize}	
\vfill\item The IV is independent of the vector of potential outcomes and potential treatment assignments (i.e. ``as good as randomly assigned'') 
%\vfill\item First two children of the same gender are assigned to families randomly. That is, they are assigned to those with higher likelihood of working just as often as it is assigned to those less likely to work.
\vfill\item It's all about the \emph{randomness} of the instrument, in other words, not the instrument's effect
\end{itemize}

\end{frame}


\begin{frame}[plain]{Independence}

		 Independence means that the first stage measures the causal effect of $Z_i$ on $D_i$:
			\begin{eqnarray*}
			E[D_i|Z_i=1] - E[D_i|Z_i=0] &=& E[D^1_{i} | Z_i = 1] - E[D^0_{i}|Z_i = 0] \\
			&=& E[D^1_{i} - D^0_{i}]
			\end{eqnarray*}

\end{frame}

\begin{frame}[plain]{Independence}
	The  independence assumption is sufficient for a causal interpretation of the reduced form:
			\begin{eqnarray*}
			E[Y_i | Z_i=1] - E[Y_i | Z_i=0] &=& E[Y_i(D^1_{i},1)|Z_i = 1] \\
			&& - E[Y_i(D^0_{i},0) | Z_i = 0] \\
			&=&E[Y_i(D^1_{i},1)] - E[Y_i(D^0_{i},0)]
			\end{eqnarray*}
\end{frame}

\begin{frame}[plain]\frametitle{Exclusion Restriction}

	\begin{block}{Exclusion Restriction}
	$\textbf{Y(D,Z)}=\textbf{Y(D,Z')}$ for all $\textbf{Z}$, $\textbf{Z'}$, and for all $\textbf{D}$
	\end{block}
	
\begin{itemize}
\vfill\item Any effect of $Z$ on $Y$ must be via the effect of $Z$ on $D$. In other words, $Y_i(D_i,Z_i)$ is a function of $D$ only.  Or formally:$$Y_i(D_i,0)=Y_i(D_i,1) \text{ for }D=0,1$$
\vfill\item Sometimes called the ``only through'' assumption because you're assuming the effect of $Z$ on $Y$ is ``only through'' its effect on $D$.
\end{itemize}
	
\end{frame}





\begin{frame}[plain]{Exclusion restriction}

	
	\begin{itemize}
	\vfill\item Use the exclusion restriction to define potential outcomes indexed only by the treatment status: 
		\begin{eqnarray*}
		 Y^1_{i} &=& Y_i(1,1) = Y_i(1,0) \\
		 Y^0_{i} &=& Y_i(0,1) = Y_i(0,0)
		\end{eqnarray*}
	\vfill\item Rewrite the switching equation:
		\begin{eqnarray*}
		Y_i &=& Y_i(0,Z_i) + [Y_i(1,Z_i) - Y_i(0,Z_i)]D_i \\
		Y_i &=& Y^0_{i} + [Y^1_{i} - Y^0_{i}]D_i
		\end{eqnarray*}
	\vfill\item Random coefficients notation for this is:
		\begin{align*}
		&Y_i = \alpha_0 + \delta_iD_i& \\
		&\text{with }\alpha_0	= E[Y^0_{i}]\text{ and }\delta_i = Y^1_{i} - Y^0_{i}
		\end{align*}
	\end{itemize}

\end{frame}

\begin{frame}[plain]{Spotting violations of exclusion is a sport}


Watch the gears turn:
\begin{itemize}
\vfill\item We are interested in causal effect of military service on earnings, and so use draft number are instrument for military service. 
\vfill\item Draft number is generated by a random number generator. Therefore independence is met as draft number is independent of potential outcomes and potential treatment status. 
\vfill\item But, people with higher draft numbers evade draft by investing in schooling. Earnings change for reasons other than military service. Exclusion is violated
\vfill\item In other words, random lottery numbers (independence) do not imply that the exclusion restriction is satisfied
\end{itemize}

\end{frame}


\begin{frame}[plain]{Strong first stage}

	
	\begin{block}{Nonzero Average Causal Effect of $Z$ on $D$}
	$E[D^1_{i} - D^0_{i}]\neq{0}$
	\end{block}
				
\begin{itemize}
\vfill\item $D^1$ means instrument is turned on, and $D^0$ means it is turned off. We need treatment to change when instrument changes.
\vfill\item $Z$ has to have some statistically significant effect on the average probability of treatment
\vfill\item First two children of the same gender makes you more likely to have a third.
\vfill\item Finally -- a testable assumption. We have data on $Z$ and $D$
\end{itemize}

\end{frame}			


\begin{frame}[plain]{Monotonicity}

	
	\begin{block}{Monotonicity}
	Either $\pi_{1i}\geq{0}$ for all $i$ or $\pi_{1i}\leq{0}$ for all $i=1, \dots, N$
	\end{block}

\begin{itemize}

\vfill\item Recall that $\pi_{1i}$ is the reduced form causal effect of the instrumental variable on an individual $i$'s treatment status.  
\vfill\item Monotonicity requires that the instrumental variable (weakly) operate in the same direction on all individual units.  
\vfill\item In other words, while the instrument may have no effect on some people, all those who are affected are affected \emph{in the same direction} (i.e., positively or negatively, but not both).
\vfill\item Without monotonicity, IV estimators are not guaranteed to estimate a weighted average of the underlying causal effects of the affected group, $Y^1_{i} - Y^0_{i}$.

\end{itemize}

\end{frame}


\begin{frame}[plain]{Force yourself to think of monotonicity violations}


\begin{itemize}	
\vfill\item  In the quarter of birth example for schooling, this assumption may not be satisfied  
\vfill\item Being born in the $4^{th}$ quarter (which typically increases schooling) may have reduced schooling for some because their school enrollment was held back by their parents
\end{itemize}

\end{frame}



\begin{frame}[plain]{Local average treatment effect}

If all 1-5 assumptions are satisfied, then IV estimates the \textbf{local average treatment effect (LATE)} of $D$ on $Y$: $$\delta_{IV,LATE} =\frac{\text{Effect of Z on Y}}{\text{Effect of Z on D}}$$

\end{frame}	

\begin{frame}[plain]{Estimand}

				
	Instrumental variables (IV) estimand: 
	\begin{align*}
	\delta_{IV,LATE} & = \frac{E[Y_i(D^1_i, 1) - Y_i(D^0_i, 0)]}{E[D^1_i - D^0_i]}& \\
	& = E[(Y^1_i - Y^0_i) | D^1_i - D^0_i = 1]
	\end{align*}

\end{frame}		

\begin{frame}[plain]{Local Average Treatment Effect}

	
	\begin{itemize}
	\vfill\item The LATE parameters is the average causal effect of $D$ on $Y$ for those whose treatment status was changed by the instrument, $Z$
	\vfill\item For example, IV estimates the average effect of military service on earnings for the subpopulation who enrolled in military service because of the draft but would not have served otherwise. 
	\vfill\item LATE does not tell us what the causal effect of military service was for patriots (volunteers) or those who were exempted from military service for medical reasons 
	\end{itemize}
	
\end{frame}

\begin{frame}[plain]{LATE cont.}


\begin{itemize}

	\vfill\item We have reviewed the properties of IV with heterogenous treatment effects using a very simple dummy endogenous variable, dummy IV, and no additional controls example.  
	\vfill\item The intuition of LATE generalizes to most cases where we have continuous endogenous variables and instruments, and additional control variables.

\end{itemize}

\end{frame}

\begin{frame}[plain]{LATE and subpopulations}

	
The instrument partitions any population into 4 distinct groups:
		\begin{enumerate}
		\vfill\item \underline{Compliers}: The subpopulation with $D_i^1=1$ and $D_i^0=0$. Their treatment status is affected by the instrument in the ``correct direction''.
		\vfill\item \underline{Always takers}: The subpopulation with $D^1_{i}=D^0_{i}=1$. They always take the treatment independently of $Z$.
		\vfill\item \underline{Never takers}: The subpopulation with $D^1_{i}=D^0_{i}=0$. They never take the treatment independently of $Z$.
		\vfill\item \underline{Defiers}: The subpopulation with $D^1_{i}=0$ and $D^0_{i}=1$. Their treatment status is affected by the instrument in the ``wrong direction''.
		\end{enumerate}
\end{frame}

\begin{frame}[plain]{Subpopulations of soldieres}

	
Examples of subpopulations:
		\begin{enumerate}
		\vfill\item \underline{Compliers}: I only enrolled in the military because I was drafted otherwise I wouldn't have served
		\vfill\item \underline{Always takers}: My family have always served, so I serve regardless of whether I am drafted
		\vfill\item \underline{Never takers}: I'm a contentious objector so under no circumstances will I serve, even if drafted
		\vfill\item \underline{Defiers}: When I was drafted, I dodged. But had I not been drafted, I would have served. I can't make up my mind.
		\end{enumerate}
\end{frame}


\begin{frame}[plain]
	\begin{columns}[t]
	\scriptsize
	\column{.4\textwidth}
	\begin{block}{Never-Takers}
		$D^1_i - D^0_i = 0$ \\
		$Y_i(0,1) - Y_i(0,0) = 0$ \\
		By \textcolor{red}{Exclusion Restriction}, causal effect of $Z$ on $Y$ is zero.
	\end{block}
	\begin{block}{Defier}
		$D^1_i - D^0_i = -1$ \\
		$Y_i(0,1) - Y_i(1,0) = Y_i(0) - Y_i(1)$ \\
		By \textcolor{red}{Monotonicity}, no one in this group
	\end{block}
	\column{.4\textwidth}
	\begin{block}{Complier}
		$D^1_i - D^0_i = 1$ \\
		$Y_i(1,1) - Y_i(0,0) = Y_i(1) - Y_i(0)$ \\
		Average Treatment Effect among Compliers
	\end{block}
	\begin{block}{Always-taker}
		$D^1_i - D^0_i = 0$ \\
		$Y_i(1,1) - Y_i(1,0) = 0$ \\
		By \textcolor{red}{Exclusion Restriction}, causal effect of $Z$ on $Y$ is zero.
	\end{block}
	\end{columns}
\end{frame}


\begin{frame}[plain]{Monotonicity Ensures that there are no defiers}
	
	\begin{itemize}
	\vfill\item Why is it important to not have defiers?
		\begin{itemize}
		\vfill\item If there were defiers, effects on compliers could be (partly) canceled out by opposite effects on defiers
		\vfill\item One could then observe a reduced form which is close to zero even though treatment effects are positive for everyone (but the compliers are pushed in one direction by the instrument and the defiers in the other direction)
		\end{itemize}
	\vfill\item Monotonicity assumes there are no defiers
	\end{itemize}

\end{frame}

\begin{frame}[plain]{What Does IV (Not) Estimate?}

	
	\begin{itemize}
	\vfill\item As said, with all 5 assumptions satisfied, IV estimates the average treatment effect for \emph{compliers}, or LATE
	\vfill\item Without further assumptions (e.g., constant causal effects), LATE is not informative about effects on never-takers or always-takers because the instrument does not affect their treatment status
	\vfill\item So what?  Well, it matters because in most applications, we would be mostly interested in estimating the average treatment effect on the whole population:$$ATE = E[Y^1_i - Y^0_i]$$
	\vfill\item But that's not possible usually with IV
	\end{itemize}

\end{frame}

%		
%\begin{frame}[plain]{Sensitivity to assumptions: exclusion restriction}
%	
%\begin{itemize}
%	
%\vfill\item Someone at risk of draft (low lottery number) changes education plans to retain draft deferments and avoid conscription. 
%
%\vfill\item Increased bias to IV estimand through two channels:
%		\begin{itemize}
%		\vfill\item Average direct effect of $Z$ on $Y$ for compliers
%		\vfill\item Average direct effect of $Z$ on $Y$ for noncompliers multiplied by odds of being a non-complier
%		\end{itemize}
%
%\vfill\item Severity depends on: 
%		\begin{itemize}
%		\vfill\item Odds of noncompliance (smaller $\rightarrow$ less bias)
%		\vfill\item ``Strength'' of instrument (stronger $\rightarrow$ less bias)
%		\vfill\item Effect of the alternative channel on $Y$
%		\end{itemize}
%\end{itemize}
%
%\end{frame}
%
%
%\begin{frame}[plain]{Sensitivity to assumptions: Monotonicity violations}
%
%
%\begin{itemize}
%
%\vfill\item Someone who would have volunteered for Army when not at risk of draft (high lottery number) chooses to avoid military service when at risk of being drafted (low lottery number)
%	
%\vfill\item Bias to IV estimand (multiplication of 2 terms):
%		\begin{itemize}
%		\vfill\item Proportion defiers relative to compliers
%		\vfill\item Difference in average causal effects of $D$ on $Y$ for compliers and defiers
%		\end{itemize}
%\vfill\item Severity depends on:
%		\begin{itemize}
%		\vfill\item Proportion of defiers (small $\rightarrow$ less bias)
%		\vfill\item ``Strength'' of instrument (stronger $\rightarrow$ less bias)
%		\vfill\item Variation in effect of $D$ on $Y$ (less $\rightarrow$ less bias)
%		\end{itemize}
%\end{itemize}
%		
%\end{frame}


		
		
	
		


\begin{frame}[plain]{Summarizing}


	\begin{itemize}
	\vfill\item The potential outcomes framework gives a more subtle interpretation of what IV is measuring
		\begin{itemize}
		\vfill\item In the constant coefficients world, IV measures $\delta$ which is ``the'' causal effect of $D_i$ on $Y_i$, and assumed to be the same for all $i$ units
		\vfill\item In the random coefficients world, IV measures instead an \emph{average} of heterogeneous causal effects across a particular population -- $E[\delta_i]$ for some group of $i$ units
	\vfill\item IV, therefore, measures the \emph{local average treatment effect} or LATE parameter, which is the average of causal effects across the subpopulation of \emph{compliers}, or those units whose covariate of interest, $D_i$, is influenced by the instrument. 
		\end{itemize}
	\end{itemize}

\end{frame}

%\begin{frame}[plain]{Summarizing}
%
%
%		\begin{itemize}
%		\vfill\item Under heterogenous treatment effects, Angrist and Evans (1996) identify the causal effect of the gender composition of the first two kids on labor supply		
%		\vfill\item This is not the same thing as identifying the causal effect of children on labor supply; the former is a LATE whereas the latter might be better described as an ATE
%		\vfill\item \emph{Ex post} this is probably obvious, but like many obvious things, it wasn't obvious until it was worked out.  This was a real breakthrough (see Angrist, Imbens and Rubin 1996; Imbens and Angrist 1994)
%		\end{itemize}
%
%\end{frame}
	
%\begin{frame}[shrink=20,plain]

%	\begin{center}
%	\textbf{Other potentially interesting treatment effects}
%	\end{center}
	
%	\begin{itemize}
%	\vfill\item Another effect which we may be potentially interested in estimating is the familiar estimand, the average treatment effect on the treatment group (ATT)
%	\vfill\item \underline{Remark}: LATE is \emph{not} the same as ATT, though.
%		\begin{eqnarray*}
%		\underbrace{E[Y_i^1 - Y_i^0 | D_i=1]}_{ \mathclap{\text{ATT}} }&=& \underbrace{E[Y_i^1 - Y_i^0 | D_i^0 = 1]}_{ \mathclap{\text{Effect on always takers}}} P[D_i^0 = 1 | D_i = 1]\\
%		& &+ \underbrace{E[Y^1_i - Y^0_i | D_i^1>D_i^0]}_{ \mathclap{\text{Effect on compliers}} } P[D_i^1 > D_i^0, Z_i=1 | D_i=1]
%		\end{eqnarray*}
%	\vfill\item The average treatment effect on the treated, ATT, is a weighted average of the effects on always-takers and compliers.
%		\begin{itemize}
%		\vfill\item \underline{Question}: What are the weights? 
%		\end{itemize}
%	\vfill\item If there are no always takers we can, however, estimate ATT which is equal to LATE in that case. 
%	\end{itemize}
	
%\end{frame}




	
		
%\begin{frame}[plain]
%	\begin{center}
%	\textbf{Discussions and questions}
%	\end{center}

%	\begin{itemize}
%	\vfill\item When might we \emph{not} be interested in the local average treatment effect?
%		\begin{itemize}
%		\vfill\item \underline{Romneycare in Massachusetts examples}: If the compliance rate or treatment effects differ in the community than during some quasi-experimental expansion, are we more interested in LATE, ATT or ATE?
%		\vfill\item What might be other examples of this in economics?  In education?
%		\vfill\item This has a similar flavor to methodological questions regarding a study's ``external'' vs. ``internal validity''
%		\end{itemize}
%	\end{itemize}
%\end{frame}

%\begin{frame}[plain]
%\begin{center}
%\textbf{Discussions and questions}
%\end{center}

%\begin{itemize}
%	 \vfill\item What do we make of the fact that LATE is defined for an \emph{unobservable sub-population} (i.e., can't label all units in the population as compliers or noncompliers)?
%	 \vfill\item What do we make of the fact that IV identification is based on a set of untestable assumptions?
%		\begin{itemize}
%		\vfill\item For example: colonial settler mortality ($Z$) influences economic development ($Y$) \emph{only through} $Z$'s association with human capital accumulation rather than institutions, $D$ (Acemoglu, Johnson and Robinson, 2001).
%		\end{itemize}
%\end{itemize}

%\end{frame}



\section{Imperfect Compliance}


%\begin{frame}{IV in Randomized Trials}
%	
%	\begin{itemize}
%	\vfill\item In many randomized trials, participation is nonetheless voluntary among those randomly assigned to treatment
%	\vfill\item Consequently, noncompliance is not uncommon and without correcting for it, creates selection biases
%	\vfill\item IV designs may even be helpful when evaluating a randomized trial, even though treatment was randomly assigned
%	\vfill\item The solution is to instrument for treatment with whether you ``where assigned to treatment'' and estimate LATE
%	\end{itemize}
%	
%\end{frame}
%
%	
%\begin{frame}[plain]{IV in Randomized Trials}
%	\begin{itemize}
%	\vfill\item The instrument is your randomized treatment
%	\vfill\item Examples might be randomized lottery for attending charter schools to study effect of charter schools on educational outcomes, or a randomized voucher to encourage the collection of health information
%	\end{itemize}
%\end{frame}
%
%
%
\subsection{Non-Compliance in Treatment Group Only}

\frame{{Compliance}
\begin{itemize}
\vfill \item Most RCTs examine programs that will not be universally adopted when offered
\vfill \item \textbf{Compliance}: Whether someone takes the treatment when they are offered
\begin{itemize}
\vfill \item In the case of a new type of farming practice there will be farmers offered the practice who do not adopt it
\vfill \item In the case of a job training program there will be entrepreneurs who choose not to attend the training
\vfill \item These are the non-compliers
\end{itemize}
\vfill \item  Let $C_i$ be the compliance status of individual $i$
\begin{itemize}
\vfill \item If she chooses to accept the program then $C_i = 1$ 
\vfill \item If not then $C_i = 0$
\end{itemize}
\vfill \item  Two impacts: intention-to-treat (ITT) and treatment-on-the-treated (ToT)
\end{itemize}
}

\frame{{Intention to Treat Effect}
\begin{itemize}
\vfill \item  The Intention to Treat Effect $$ITT= E(Y_{1i}|T_i = 1) - E(Y_{0i}|T_i = 0)$$
\vfill \item The ITT essentially ignores non-compliance: estimates the effect of `intending to treat' some units, regardless of how many take up the treatment
\vfill \item Partially sidesteps compliance issues: Focus on treatment/ignore compliance
\vfill \item It cannot completely escape compliance because a decreasing compliance rate will push the ITT towards zero
\end{itemize}
}

\frame{{Treatment Effect on the Treated}
\begin{itemize}
\vfill \item  The Treatment Effect on the Treated $$ToT= E(Y_{1i}|T_i = 1;C_i = 1) - E(Y_{0i}|T_i = 0;C_i = 1)$$
\vfill \item  This is the treatment effect on those who actually choose to accept the treatment
\vfill \item \textbf{The counterfactual is those who would have accepted the treatment if they had been offered it}
\vfill \item Non-compliance drives down the ITT relative to the ToT
\vfill \item If a program has no spillover effect (i.e., non-compliers in the treatment area receive no indirect effect from the treatment taking place around them), the treatment effect on the non-compliers is 0
\end{itemize}
}

\frame{{Treatment Effect on the Treated}
There is a mechanical relationship between the ITT and ToT
\begin{eqnarray*}
ITT &=& E(Y_{1i}|T_i = 1) - E(Y_{0i}|T_i = 0)\\
\pause
\vspace{1cm}
&=& cE(Y_{1i}|T_i = 1;C_i = 1)+(1-c)E(Y_{1i}|T_i = 1;C_i = 0) -\\
&& cE(Y_{1i}|T_i = 0;C_i = 1)-(1-c)E(Y_{1i}|T_i = 0;C_i = 0)\\
\pause
\vspace{1cm}
 &=& c\left[ E(Y_{1i}|T_i = 1;C_i = 1)-E(Y_{0i}|T_i = 0;C_i=1) \right] +\\
 &&(1-c) \underbrace{\left[E(Y_{1i}|T_i = 1;C_i = 0)-E(Y_{1i}|T_i = 0;C_i = 0) \right]}_{\text{zero because of no spillovers (i.e., exclusion restriction)}}\\
 \pause
 \vspace{1cm}
 &=& ToT*c
\end{eqnarray*}
where $c$ is the compliance rate
}

\frame{{Treatment Effect on the Treated}
\begin{itemize}
\vfill \item  Compliance is not typically observed in the control group! 
\vfill \item  Estimator for the ToT given above cannot be estimated with standard data
\vfill \item  If we are willing to assume that there is no interference with the control group then we can back out the ToT as $ITT/c$
\vfill \item Standard empirical way of estimating ToT effects is to instrument actual receipt of treatment with being offered treatment 
\begin{itemize}
\vfill \item Run a regression with compliance as the endogeneous variable
\vfill \item Being in the treatment group is the instrument
\end{itemize}
\vfill \item In a regression without any other control variables, this instrumented ToT will be exactly the ITT blown up by the inverse of the compliance rate.
\end{itemize}
}


\frame{{Treatment Effect on the Treated}
\begin{itemize}
\vfill \item Think of the compliance as an endogenous variable with an IV (treatment)
\begin{eqnarray*}
C_i &=& \gamma_0+\gamma_1 T_i +\mu_i\\
Y_i &=& \beta_0+\beta_1 \widehat{C_i} +\varepsilon
\end{eqnarray*}
\vfill \item $\widehat{C_i}=c$ (i.e, the compliance rate in the treatment group)
\vfill \item Regressing the outcome on the treated yields the ITT
\vfill \item  Thus, $\widehat{\beta_1}=\frac{ITT}{c}=ToT$
\end{itemize}
}

\subsection{Two-sided non-compliance}

\frame{{Two-sided non-compliance}
\begin{itemize}
\vfill \item Two-sided non-compliance:
\begin{itemize}
\vfill \item  Individuals in the control who get treated
\vfill \item Individuals in the treatment who do not comply
\end{itemize}
\vfill \item In this context it is natural to think of the treatment simply as something that boosts compliance, and not as the actual receipt of the treatment itself
\begin{itemize}
\vfill \item Email encouraging people to do something
\vfill \item Facebook/Twitter/Google ads with information
\end{itemize}
\vfill \item  We can of course continue to estimate a kind of ITT in this context (difference between the group offered the ``treatment'' and the group not offered)
\vfill \item  What we are estimating with the ITT is the \textbf{impact of the intervention that changes compliance and not the impact of the treatment itself}
\vfill \item  If the compliance rate in the treatment and control groups is the same, we have no experiment at all!
\end{itemize}
}


\frame{{Local Average Treatment Effects}
\begin{itemize}
\vfill \item The treatment and compliance possibilities define four possible cells (assuming that the purpose of the treatment is to increase compliance):
\begin{enumerate}
\vfill \item Always takers: $c_i(T_i=0)=c_i(T_i=1)=1$
\vfill \item Never takers: $c_i(T_i=0)=c_i(T_i=1)=0$
\vfill \item Compliers: $c_i(T_i=0)=0$ and $c_i(T_i=1)=1$
\vfill \item Defiers: $c_i(T_i=0)=1$ and $c_i(T_i=1)=0$
\end{enumerate}
\end{itemize}
}



\frame{{Local Average Treatment Effects}
\begin{itemize}
\vfill \item We are not typically interested in the impact of the intervention to boost compliance, but rather the impact of the treatment itself
\vfill \item We can instrument compliance with offering the treatment: In some ways this is simply a standard implementation of the instrumented TOT
\vfill \item Abadie and Imbens: Cannot use this instrument to understand the effect of the promotion on ``always compliers'' nor on of the ``defiers''
\vfill \item In other words, the instrument has no first-stage for groups that were going to comply or not comply in the absence of the promotion 
\vfill \item What we estimate with this technique is the Local Average Treatment Effect
\vfill \item This is the impact of the actual treatment (rather than the promotion), estimated only upon those types who were induced to comply by the promotion
\end{itemize}
}

\frame{{Local Average Treatment Effects}
\begin{itemize}
\vfill \item The analogy to the estimation of the ToT with one-sided non-compliance would be to inflate the ITT estimated from a Randomized Promotion design by the differential compliance between the treatment and control
\vfill \item But in order to do this we must make an assumption stronger than the ``Non-Interference and Exclusion Restriction'' assumptions already laid out
\vfill \item We must add a Monotonicity assumption known as the ``No Defiers'' assumption
\vfill \item The reason we need this assumption is precisely the heterogeneity of impacts
\vfill \item Under homogeneous impacts and the exclusion restriction, if the fraction of Defiers and Compliers in the sample were equal, we could not have a treatment effect
\end{itemize}
}

\frame{{``No Defiers'' assumption}
\begin{itemize}
\vfill \item We set the fraction of defiers to zero: $\pi_D = 0$
\vfill \item Then
\begin{itemize}
\vfill \item Fraction of always takers: $\pi_{AT} = E[C_i(T_i=0)]$
\vfill \item  Fraction of never takers: $\pi_{NT} = 1 - E[C_i(T_i=1)]$
\vfill \item Fraction of compliers: $\pi_C = E[C_i(T_i=1) - C_i(T_i=0)]$
\end{itemize}
\end{itemize}
}

\frame{{Local Average Treatment Effects}
\begin{itemize}
\vfill \item We can write the ITT as a weighted average of outcomes in the four cells:
\begin{eqnarray*}
ITT &=& \pi_C  E[Y_i(T_i = 1; C_i = 1) - Y_i(T_i = 0; C_i = 1)] +\\
&& \pi_{AT} \underbrace{E[Y_i (T_i = 1; C_i = 1) - Y_i (T_i = 0; C_i = 1)]}_{\text{zero by the exclusion restriction (no spillovers)}}+\\
&&\pi_{NT}  \underbrace{E[Y_i (T_i = 1; C_i = 0) - Y_i (T_i = 0; C_i = 0)]}_{\text{zero by the exclusion restriction (no spillovers)}} +\\
&& \underbrace{\pi_D  E[Y (T_i = 1; C_i = 0) - Y_i (T_i = 1; C_i = 0)]}_{\text{zero by the no defier assumption}}\\ \pause
&=& \pi_C  E[Y_i(T_i = 1; C_i = 1) - Y_i(T_i = 0; C_i = 1)]
\end{eqnarray*}

\end{itemize}
}

\frame{{Local Average Treatment Effects}
\begin{itemize}
\vfill \item Problem: I can tell the fraction of compliers in the population (by comparing uptake rates in treatment relative to the control) but I cannot tell which individuals were induced to comply by the promotion
\vfill \item  This LATE may be interesting (if the promotion is a real policy that is being considered, or is based off of price variation that we will really observe)
\vfill \item ...Or may be completely artificial (if the promotion induces a group to comply that would never comply in the native implementation of the program)
\end{itemize}
}


\frame{{Local Average Treatment Effects}
\begin{quote}
Imbens: Reporting the local average treatment effect, solely, or in combination with bounds or point estimates for the overall average based on additional assumptions, is thus emphatically not motivated by a claim that the local average treatment effect is the sole or primary effect of interest. Rather, it is motivated by a sober assessment that estimates for other subpopulations do not have the same internal validity, and by an attempt to clarify what can be learned from the data in the absence of identification of the population average effect
\end{quote}
}

\subsection{Are LATEs Policy Relevant?}
\frame{{When are LATEs what we want to measure?}
\begin{itemize}
\vfill \item A price randomization where the implementer is considering a range of different prices/subsidies and the experiment includes the relevant range (this design still only gives the marginal impact and not the impact on the whole client pool)
\vfill \item Eligibility randomization 'on the bubble' where the question answered is the impact of extending access on the eligibility margin
\vfill \item A randomized promotion intervention where a technology is universally available but not widely adopted, so the relevant policy question is the effect of expanding uptake through adoption-enhancing interventions
\end{itemize}
}


\frame{{When are LATEs \textbf{NOT} what we want to measure?}
\begin{itemize}
\vfill \item A price incentive randomization in a context where the product is provided by the private market and the prices in the study will never be observed in reality
\vfill \item Randomized promotion campaign where the promotion is so expensive that it yields a group of beneficiaries who would never take the product in reality
\vfill \item LATE or IV based on variation that selects an odd sample that is not representative of the implementation population (e.g., Deaton's earthquakes example)
\end{itemize}
}


%\frame{{Example: Thornton (2008), The Demand for, and Impact of, Learning HIV Status}
%\begin{itemize}
%\vfill \item Even with widespread HIV testing, many people choose not to learn their status
%\vfill \item Obvious and potentially cost-effective solution is to pay them to learn their results
%\vfill \item Two-sided non-compliance:  33\% of those without incentives learned their HIV status, and 21\% of those with incentives did not learn their HIV status
%\vfill \item More complicated than a standard LATE:
%\begin{itemize}
%\vfill \item Incentives become increasingly important to compliance as distance grows
%\vfill \item As distance increases the two-sided LATE closer to a one-sided ToT
%\end{itemize}
%\end{itemize}
%}


\section{Re-cap}

\begin{frame}{Likely source of OLS bias? Exclusion restriction? First stage?}
\begin{itemize}
\vfill\item Vietnam draft lottery
\vfill\item Job Training Partnership Act (JTPA) randomized trial
\vfill\item Ocean weather
\vfill\item Rainfall
\vfill\item Slope of land
\end{itemize}
\end{frame}


\begin{frame}{When is IV used?}
Instrumental variables methods are typically used to address the following kinds of problems
		\begin{enumerate}
		\vfill\item Omitted variable bias
		\vfill\item Measurement error
		\vfill\item Simultaneity bias
		\vfill\item Reverse causality
		\vfill\item Randomized control trials with noncompliance
		\end{enumerate}
\end{frame}

\begin{frame}{Instrumental variables}
\begin{itemize}
\vfill\item Instrumental variables offers some hope at recovering the causal effect of $D$ on $Y$
\vfill\item The best instruments come from deep knowledge of institutional details (Angrist and Krueger 1991)
\vfill\item Certain types of natural experiments can be the source of such opportunities and may be useful
\end{itemize}
\end{frame}

\end{document}